/**
 * Copyright (C), 2015-2020, XXX有限公司
 * FileName: ProduceController
 * Author:   Administrator
 * Date:     2020/11/24 14:26
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package io.renren.modules.live.controller;

import io.renren.modules.live.entity.ProduceInfo;
import io.renren.modules.live.util.RabbitUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author Administrator
 * @create 2020/11/24
 * @since 1.0.0
 */
@Api(tags = "后台RabbitMqQ管理1")
@RestController
@RequestMapping("/produce")
public class ProduceController {

    @Autowired
    private RabbitUtil rabbitUtil;

    /**
     * 发送消息到交换器
     * @param produceInfo
     */

    //或者rabbitTemplate.convertAndSend(exchange, routingKey, message);  发送消息到交换器
    @PostMapping("sendMessage")
    public void sendMessage(@RequestBody ProduceInfo produceInfo) {
        //交换器名称,路由key, 消息
        rabbitUtil.convertAndSend(produceInfo.getExchangeName(), produceInfo.getRoutingKey(), produceInfo);
    }

}